<script setup>
import {onLoad} from '@dcloudio/uni-app';
import { ref} from 'vue'
import * as Api from '/api/questions'
let writingList1 = ref([])
let writingList2 = ref([])
onLoad(async ()=>{
  let res = await Api.getQuestionsList(0)
  let res1= await Api.getQuestionsList(5)
  writingList1.value = res.data
  writingList2.value = res1.data
})
const goWritingDetail1 = (title,id) => {
  uni.navigateTo({
    url: `/pages/index/questions?type=0&title=${title}&id=${id}`
  })
}
const goWritingDetail2 = (title,id) => {
  uni.navigateTo({
    url: `/pages/index/questions?type=5&title=${title}&id=${id}`
  })
}
</script>
<template>
  <view style="padding: 20rpx 0;">
  <van-tabs type="card" color = '#0AD192'>
    <van-tab title="写作">
      <scroll-view scroll-y>
        <view v-for="item in writingList1" @click="goWritingDetail1(item.title,item.id)" style="box-shadow: 0 0 10rpx rgba(0,0,0,0.1);margin: 20rpx auto;width: 700rpx;height:80rpx;font-size: 28rpx;color: #7c7c7c;border-radius: 10rpx;display: flex;align-items: center;justify-content: space-around;background-color: white;padding: 10rpx;">
          <view style="width: 600rpx">{{item.title}}</view>
          <van-icon name="arrow" />
        </view>
      </scroll-view>

    </van-tab>
    <van-tab title="翻译">
      <scroll-view scroll-y>
        <view v-for="item in writingList2" @click="goWritingDetail2(item.title,item.id)" style="box-shadow: 0 0 10rpx rgba(0,0,0,0.1);margin: 20rpx auto;width: 700rpx;height:80rpx;border-radius: 10rpx;font-size: 28rpx;color: #7c7c7c;display: flex;align-items: center;justify-content: space-around;background-color: white;padding: 10rpx;">
          <view style="width: 600rpx">{{item.title}}</view>
          <van-icon name="arrow" />
        </view>
      </scroll-view>
    </van-tab>
  </van-tabs>
  </view>
</template>




<style scoped lang="scss">

</style>
